/***************************************************************************
*  Copyleft (3) 2008 by joker                                              *
*  take-cha@cyric.tohoku.ac.jp                                             *
*                                                                          *
*  This software is provided to you "AS IS," and the authors and           *
*  contributors disclaim any warranty or liability obligations to you      *
*  of any kind, implied or express, including but not limited to the       *
*  warranties of merchantability, fitness for a particular purpose,        *
*  and non-infringement.                                                   *
***************************************************************************/
#ifndef VIEWCLS_H
#define VIEWCLS_H

#include "geometry.h"
#include "view.h"
#include <qimage.h>
//#include <qmouseevent.h>

class viewCls: public view {
Q_OBJECT
public:
    viewCls(QWidget *parent = 0, const char *name = 0);
QString cpt;
QImage *img0; // original
QImage *img0g; // original gray
QImage *img;
QImage *imgs;
QImage *xprof0,*yprof0;
QPixmap pm,pm0;
int drawprof;
int nx0,ny0; // the original
int nx1,ny1; // scaled but landscape
int nx_,ny_;   // scaled and rot
int xprof_nx,xprof_ny;
int yprof_nx,yprof_ny;
int zmaxx,zmaxy;
float cf0,cf;
int profx_in,profy_in;
QString drawnmess;
int cx,cy;
int cx0,cy0;
int csron;
// int ncol;
double rot;
double drot;

void drawProfx(int y);
void drawProfy(int x);
void drawProfRect();
void drawMess(QString mess, int where=0);
void putCross();
void restoreImg();
void drawCross(int x, int y);
void eraseCross();
void rotImg();
void expandView();
void shrinkView();
void setGray(QImage *);
void restoreImg0();
void csrtog();
void updateGeom();
void hflip();
void vflip();
QWMatrix mkxmat();
void doxform(QWMatrix m);
bool vf,hf;
bool dispmm;
bool crossput;


	public slots:
	void cpImage(QImage *in);
	void reallocImg();

	protected:
		/*$PROTECTED_FUNCTIONS$*/
		void   paintEvent ( int );
void        mousePressEvent( QMouseEvent * );
void        mouseMoveEvent( QMouseEvent * );
void   paintEvent ( QPaintEvent *event );
void keyPressEvent ( QKeyEvent * e );
};

#endif
